﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace AllInOne.Entity
{
    public class DrivingLicence
    {
        public string xm { get; set; } //姓名
        public string xb{ get; set; } //性别 1男 2女
        public string sfzmhm{ get; set; } //身份证明号码
        public string csrq{ get; set; } //出生日期 1972-02-26 00:00:00.0
        public string lxzsxzqh{ get; set; }
        public string lxzsxxdz{ get; set; } //住址
        public string lxzsyzbm{ get; set; }
        public string sjhm{ get; set; } //手机号码
        public string fzjg{ get; set; } //签发机关
        public string jzqx{ get; set; } //驾照期限
        public string yxqs{ get; set; } //有效期始
        public string yxqz{ get; set; } //有效期止
        public string cclzrq{ get; set; } //初次领证日期
        public string zjcx{ get; set; } //准驾车型
        public string gj{ get; set; } //国籍
        public string lxdh{ get; set; }
        public string dzyx{ get; set; }
        public string zt{ get; set; }
        public string ljjf{ get; set; }
        public string dabh{ get; set; }
        public string ztmc { get; set;}
        public string xbmc { get; set; }

        public static DrivingLicence ParseObject(JObject json)
        {
            try
            {
                if (json != null)
                {
                    DrivingLicence drivingLicense = new DrivingLicence();
                    drivingLicense.xm = json["xm"]!=null? json["xm"].ToString():"";
                    drivingLicense.sfzmhm = json["sfzmhm"] != null ? json["sfzmhm"].ToString() : "";
                    drivingLicense.csrq = json["csrq"] != null ? json["csrq"].ToString() : "";
                    drivingLicense.lxzsxzqh = json["lxzsxzqh"] != null ? json["lxzsxzqh"].ToString() : "";
                    drivingLicense.lxzsxxdz = json["lxzsxxdz"] != null ? json["lxzsxxdz"].ToString() : "";
                    drivingLicense.lxzsyzbm = json["lxzsyzbm"] != null ? json["lxzsyzbm"].ToString() : "";
                    drivingLicense.sjhm = json["sjhm"] != null ? json["sjhm"].ToString() : "";
                    drivingLicense.fzjg = json["fzjg"] != null ? json["fzjg"].ToString() : "";
                    drivingLicense.jzqx = json["jzqx"] != null ? json["jzqx"].ToString() : "";
                    drivingLicense.yxqs = json["yxqs"] != null ? json["yxqs"].ToString() : "";
                    drivingLicense.yxqz = json["yxqz"] != null ? json["yxqz"].ToString() : "";
                    drivingLicense.cclzrq = json["cclzrq"] != null ? json["cclzrq"].ToString() : "";
                    drivingLicense.zjcx = json["zjcx"] != null ? json["zjcx"].ToString() : "";
                    drivingLicense.gj = json["gj"] != null ? json["gj"].ToString() : "";
                    drivingLicense.lxdh = json["lxdh"] != null ? json["lxdh"].ToString() : "";
                    drivingLicense.dzyx = json["dzyx"] != null ? json["dzyx"].ToString() : "";
                    drivingLicense.zt = json["zt"] != null ? json["zt"].ToString() : "";
                    drivingLicense.ljjf = json["ljjf"] != null ? json["ljjf"].ToString() : "";
                    drivingLicense.dabh = json["dabh"] != null ? json["dabh"].ToString() : "";
                    drivingLicense.ztmc = json["ztmc"] != null ? json["ztmc"].ToString() : "";
                    drivingLicense.xbmc = json["xbmc"] != null ? json["xbmc"].ToString() : "";
                    drivingLicense.xb = json["xb"] != null ? json["xb"].ToString() : "";



                    return drivingLicense;
                }
            }
            catch (Exception e)
            {

                SimpleConsole.WriteError(e.Message,typeof(DrivingLicence));
            }
            return null;
            
        }
    }
}
